package com.xg.te.strategy;

import org.apache.log4j.Logger;

import com.alibaba.fastjson.JSONObject;

/**
 * @desc 策略代理
 * @author liuguojun
 * @date 2014-07-16
 */
public class StrategyProxy {

	private static final Logger logger = Logger.getLogger(StrategyProxy.class);

	/**
	 * 代理执行策略
	 * 
	 * @param strategy
	 * @param jsonObj
	 */
	public static void proxyExecute(final Strategy strategy,
			final JSONObject jsonObj) {
		new Thread() {
			public void run() {
				while (true) {
					strategy.execute(jsonObj);
					try {
						Thread.sleep(1000);
					} catch (InterruptedException ex) {
						logger.error(ex.getMessage(), ex);
					}
				}
			}
		}.start();
	}
}
